package application

import (
	"ruoyi/domain/entity/common"
	"ruoyi/domain/entity/response"
	"ruoyi/domain/entity/system"
	"ruoyi/domain/repository"
)

type PostApp struct {
	post repository.SysPostRepository
}

var _ PostAppInterface = &PostApp{}

type PostAppInterface interface {
	SelectUserPostGroup(userName string) string

	SelectSysPostList(params common.SearchTableDataParam, isPage bool) common.TableDataInfo

	SelectPostListByUserId(userId int) []int

	AddPostByUser(user system.SysUserParam)

	AddPostListByUser(postIds []int, userId int)

	DeletePostByUser(userIds []int)

	FindPostInfoById(postId string) system.SysPost

	SavePost(post system.SysPost) response.Response

	EditPost(sysPost system.SysPost) response.Response

	DeletePost(postIds string) response.Response
}

func (p PostApp) SelectUserPostGroup(userName string) string {
	return p.post.SelectUserPostGroup(userName)
}

func (p PostApp) SelectSysPostList(params common.SearchTableDataParam, isPage bool) common.TableDataInfo {
	return p.post.SelectSysPostList(params, isPage)
}

func (p PostApp) SelectPostListByUserId(userId int) []int {
	return p.post.SelectPostListByUserId(userId)
}

func (p PostApp) AddPostByUser(user system.SysUserParam) {
	p.post.AddPostByUser(user)
}

func (p PostApp) AddPostListByUser(postIds []int, userId int) {
	p.post.AddPostListByUser(postIds, userId)
}

func (p PostApp) DeletePostByUser(userIds []int) {
	p.post.DeletePostByUser(userIds)
}

func (p PostApp) FindPostInfoById(postId string) system.SysPost {
	return p.post.FindPostInfoById(postId)
}

func (p PostApp) SavePost(post system.SysPost) response.Response {
	return p.post.SavePost(post)
}

func (p PostApp) EditPost(sysPost system.SysPost) response.Response {
	return p.post.EditPost(sysPost)
}

func (p PostApp) DeletePost(postIds string) response.Response {
	return p.post.DeletePost(postIds)
}
